from django.db import models
from django.utils.translation import ugettext_lazy

class OpenidProvider(models.Model):
    name = models.CharField(max_length=255)
    picture = models.ImageField(ugettext_lazy(),
        blank=True, upload_to='openid-providers')

    def __unicode__(self):
        return self.name

    class Meta:
        verbose_name = ugettext_lazy('openid provider')
        verbose_name_plural = ugettext_lazy('openid providers')
        ordering = ('name',)


class OpenidUser(models.Model):
    url = models.URLField(u'url')
    name = models.CharField(max_length=255)
    provider = models.ForeignKey(OpenidProvider,
        verbose_name=ugettext_lazy('Provider'), null=True, blank=True)

    created_datetime = models.DateTimeField(ugettext_lazy('Created'), auto_now_add=True)


    def __unicode__(self):
        return self.url

    class Meta:
        verbose_name = ugettext_lazy('openid user')
        verbose_name_plural = ugettext_lazy('openid users')
        ordering = ('name',)
